<template>
  <a-card>
    <a-tabs defaultActiveKey="1">
      <a-tab-pane tab="学生信息" key="1">
        <stu-info :studentData="studentData"></stu-info>
      </a-tab-pane>
      <a-tab-pane tab="学籍信息" key="2">
        <stu-status-view :xjxx="studentData.xjxx"/>
      </a-tab-pane>
      <a-tab-pane tab="个人简历" key="3">
        <stu-resume  :resumeList="resumeList"/>
      </a-tab-pane>
      <a-tab-pane tab="社会关系" key="4">
        <stu-relation :familyList="familyList"/>
      </a-tab-pane>
    </a-tabs>
<!--    <a-row style="text-align:left;margin:30px;">
      <a-button type="primary" @click="exportPdf">导出学籍卡</a-button>
      &lt;!&ndash; <a-button type="primary" @click="back">返回列表</a-button> &ndash;&gt;
    </a-row>-->
    <!-- fixed footer toolbar -->
    <div class="ant-pro-footer-toolbar">
      <a-button style="float: right;margin-top: 10px;" :loading="loading" @click="exportPdf" type="primary">导出学籍卡</a-button>
      <a-button style="float: right;margin-top: 10px;margin-right: 30px;" @click="back">返回列表</a-button>
    </div>
  </a-card>
</template>

<script>
import stuInfo from '../../info/uncheckedList/components/stuInfo'
import stuStatusView from './component/stuStatusView'
import stuRelation from '../../info/uncheckedList/components/stuRelation'
import stuResume from '../../info/uncheckedList/components/stuResume'

export default {
  components: {
    stuInfo,
    stuStatusView,
    stuRelation,
    stuResume
  },
  data () {
    return {
      post: {},
      studentData: {
        xjxx: {}
      },
      familyList: [],
      resumeList: [],
      loading: false
    }
  },
  // watch: {
  //   xh (val) {
  //     if (val) {
  //       this.$api.student.stuXjInfo(val).then(res => {
  //         this.studentData = res.data
  //       })
  //     }
  //   }
  // },
  computed: {
    xh () {
      return this.$route.query.xh
    }
  },
  beforeCreate () {
    this.form = this.$form.createForm(this)
  },
  created () {
    this.$api.student.stuInfo(this.xh).then(res => {
      this.studentData = res.data
      this.$changeDate(this.studentData.xjxx)
    })
    this.$api.student.studentFamily(this.xh).then(res => {
      this.familyList = res.data
    })
    this.$api.student.studentResume(this.xh).then(res => {
      this.resumeList = res.data
    })
  },
  methods: {
    exportPdf () {
      let fileName = this.studentData.xm + '_学生学籍卡.pdf'
      this.$downloadPdf('/schoolRoll/xjxx/exportXjCard/' + this.xh, {}, fileName)
    },
    back () {
      // this.$emit('showList')
      this.$router.back()
    }
  }
}
</script>

<style>

</style>
